package cn.kwq.project_manger.service.impl;

import cn.kwq.project_manger.pojo.QProject;
import cn.kwq.project_manger.pojo.QTeam;
import cn.kwq.project_manger.service.DevService;
import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 30896
 */
@SuppressWarnings("ALL")
@Service
public class DevServiceImpl implements DevService {


    @Autowired
    JPAQueryFactory jpaQueryFactory;



    @Transactional
    @Override
    public void approvedAllProject() {
        QProject project=QProject.project;
        jpaQueryFactory.update(project)
                .set(project.status,1)
                .where(project.status.isNull())
                .execute();
    }

    @Override
    @Transactional
    public void approvedAllTeam() {
        QTeam team=QTeam.team;
        jpaQueryFactory.update(team)
                .set(team.status,1)
                .where(team.status.isNull())
                .execute();
    }
}
